<!DOCTYPE html>
<html>

	<head>
		<meta name="renderer" content="webkit" />
		<meta http-equiv="X-UA-COMPATIBLE" content="IE=edge,chrome=1" />
		<meta content="text/html; charset=UTF-8">
		<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no">
		<title>我的券包</title>
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/User/css/common.css" />
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/Shop/css/dropload.css" />
		<script type="text/javascript" src="/themes/wnsc_moblie/newMobile/User/js/area/jquery.min.js"></script>
		<script type="text/javascript" src="/themes/wnsc_moblie/Public/js/common.js"></script>
		<script src="/themes/wnsc_moblie/newMobile/Shop/css/dropload.js"></script>
		<link rel="stylesheet" href="/themes/wnsc_moblie/Public/layui/css/layui.css">
		<script src="/themes/wnsc_moblie/Public/layui/layui.js"></script>
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/User/css/bonus.css" />

	</head>

	<body class="body-gray">
	<?php
				$agent = $_SERVER['HTTP_USER_AGENT'];
				if(strpos($agent,"Html5Plus") === false){
			?>
		<header>
			<div class="tab_nav">
				<div class="header">
					<div class="header-left">
						<a class="sb-back" href="javascript:history.back(-1)" title="返回"></a>
					</div>
					<div class="header-middle">我的券包</div>
					<div class="header-right">
						<aside class="show-menu-btn">
							<div class="show-menu" id="show_more">
								<a href="javascript:;"></a>
							</div>
						</aside>
					</div>
				</div>
			</div>
		</header>

		<mtc_include file="Public:right_nav" />
	<?php
			}
			?>
		<div class="wrapper02" id="nav_list">
			<div class="scroller" style="width: 100%;background: #fff;">
				<ul class="clearfix" style="width: 100%;">
					<li data="0" style="width: 50%;" class="cur">
						<a href="javascript:void(0)" id='order_all'>优惠券</a>
					</li>
					<li data="1" style="width: 50%;">
						<a href="javascript:void(0)" id='order_unpayed'>抵用券</a>
					</li>
				</ul>
			</div>
		</div>
		<div id="table_list">
			<div class="com_content">
				<li class="noResultTipTmall"><img class="logo" src="/themes/wnsc_moblie/Public/images/bg_empty_list.png" alt="快抢我">
					<div class="title">您还没有购物券哦，快去领取吧</div>
					<ul>
						<li>购物券可享受更优惠的价格</li>
					</ul>
					<div data-spm="d11-grab">
						<a class="btn" href="{:U('list/coupons')}">快去抢券</a>
					</div>
				</li>
			</div>
			<div class="com_content2" style="    background: #eee;">
				<li class="noResultTipTmall"><img class="logo" src="/themes/wnsc_moblie/Public/images/bg_empty_list.png" alt="快抢我">
					<div class="title">您还没有抵用券购物券哦</div>
					<ul>
						<li>代言抵物券可享受更优惠的价格</li>
					</ul>
				</li>
				
			
				
			</div>
		</div>

		<script type="text/javascript">
			$(function() {
				ajax_getbonus();
				$('.clearfix li').click(function() {
					$('.clearfix li').removeClass('cur');
					$(this).addClass('cur');
					$key = $(this).attr('data');
					if($key == 0) {
						$('.com_content').show();
						$('.com_content2').hide();
						$('body').css('background','#fff')
						ajax_getbonus();
					}
					if($key == 1) {
						$('.com_content2').show();
						$('.com_content').hide();
						$('body').css('background','#eee')
						ajax_getdiyongbonus();
					}
				})

			})

			function ajax_getbonus() {
				var url = "{:U('user/ajax_getbonus')}";
				var amount = 6;
				layui.use('flow', function() {
					var $ = layui.jquery; //不用额外加载jQuery，flow模块本身是有依赖jQuery的，直接用即可。
					var flow = layui.flow;
					flow.load({
						elem: '.com_content', //指定列表容器
						done: function(page, next) { //到达临界点（默认滚动触发），触发下一页
							var lis = [];
							$.ajax({
								type: 'post',
								url: url,
								data: {
									page: page,
									amount: amount
								},
								dataType: 'json',
								success: function(res) {
									if(page == 1 && res.content == '') {
										$('.com_content .noResultTipTmall').show();
										next(lis.join(''), page < res.pages);
										$('.layui-flow-more').hide();
									} else {
										$('.com_content .noResultTipTmall').remove();
										lis.push(res.content)
										next(lis.join(''), page < res.pages);
									}

								}
							});

						}
					});
				});
			}

			function ajax_getdiyongbonus() {
				var url = "{:U('user/ajax_getdiyongbonus')}";
				var amount = 6;
				layui.use('flow', function() {
					var $ = layui.jquery; //不用额外加载jQuery，flow模块本身是有依赖jQuery的，直接用即可。
					var flow = layui.flow;
					flow.load({
						elem: '.com_content2', //指定列表容器
						done: function(page, next) { //到达临界点（默认滚动触发），触发下一页
							var lis = [];
							$.ajax({
								type: 'post',
								url: url,
								data: {
									page: page,
									amount: amount
								},
								dataType: 'json',
								success: function(res) {
									if(page == 1 && res.content == '') {
										$('.com_content2 .noResultTipTmall').show();
										next(lis.join(''), page < res.pages);
										$('.layui-flow-more').hide();
									} else {
										$('.com_content2 .noResultTipTmall').remove();
										lis.push(res.content)
										next(lis.join(''), page < res.pages);
									}

								}
							});

						}
					});
				});
			}
		</script>
	</body>

</html>